package com.link.common.packet.resp;

import com.link.common.util.BinaryUtils;
import io.netty.buffer.ByteBuf;

public record RegionPacket(
        short id,
        String name,
        String serverIp,
//        short serverPort,
        short delay,
        byte status,
        byte type) {


    public void writeTo(ByteBuf buffer   ){
        buffer.writeShort(id);
        BinaryUtils.writeString(buffer,name());
        BinaryUtils.writeString(buffer,serverIp());
//        buffer.putShort(serverPort);
        buffer.writeShort(delay);
        buffer.writeByte(status);
        buffer.writeByte(type);
    }
    public  int length(){
        return 14+ BinaryUtils.getStringLength(name())+BinaryUtils.getStringLength(serverIp());
    }
}
